package com.singzi.hospappo.hosp.controller.api;

import com.singzi.hospappo.common.utils.MD5;
import com.singzi.hospappo.hosp.service.HospitalSetService;

import java.util.Map;

public class CheckSign {
    public Boolean checkSign(Map<String, Object> paramMap, HospitalSetService hospitalSetService){
        //获取医院编号
        String hoscode = (String)paramMap.get("hoscode");
        //1 获取医院系统传递过来的签名,签名进行MD5加密
        String hospSign = (String)paramMap.get("sign");

        //2 根据传递过来医院编码，查询数据库，查询签名
        String signKey = hospitalSetService.getSignKey(hoscode);

        //3 把数据库查询签名进行MD5加密
        String signKeyMd5 = MD5.encrypt(signKey);
        return hospSign.equals(signKeyMd5);
    }

}
